# -*- coding: UTF-8 -*-
__author__ = 'Jeffrey'

import re

from django.http.response import HttpResponseRedirect

class HandleProfile(object):

    def process_request(self, request):  # 未进入view之前
        if re.search(r'.+/profile/', request.path):
            try:
                if request.session.get('webStatus') == "HasLogin":
                    return None
                else:
                    return HttpResponseRedirect('/account/login_page/')
            except Exception as e:
                return HttpResponseRedirect('/account/login_page/')